import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

// services
import { AuthGuardService } from '../../core/services/auth-guard.service';

// components
import { MainComponent } from './components/main/main.component';
import { GradeManagementComponent } from './components/system/grade-management/grade-management.component';
import { SubjectManagementComponent } from './components/system/subject-management/subject-management.component';
import { ClassManagementComponent } from './components/system/class-management/class-management.component';
import { RoleManagementComponent } from './components/system/role-management/role-management.component';
import { StudentManagementComponent } from './components/system/student-management/student-management.component';
import { UserManagementComponent } from './components/system/user-management/user-management.component';

// 定义子路由
// 系统设置
const systemRoutes = {
    path: 'system',
    children: [
        { path: 'grade', component: GradeManagementComponent },
        { path: 'subject', component: SubjectManagementComponent },
        { path: 'class', component: ClassManagementComponent },
        { path: 'role', component: RoleManagementComponent },
        { path: 'student', component: StudentManagementComponent },
        { path: 'user', component: UserManagementComponent }
    ]
};
// 主路由
const mainRoutes: Routes = [
    {
        path: 'main',
        component: MainComponent,
        canActivate: [AuthGuardService],
        children: [
            systemRoutes
        ]
    }
];


@NgModule({
    imports: [
        RouterModule.forChild(mainRoutes)
    ],
    exports: [
        RouterModule
    ]
})

export class MainRoutingModule {}